<?php
require('../../../public/connection.php');
require('../../../class/Mysql.php');
$data = (array)json_decode(file_get_contents("php://input", true));
if (empty($data["name"])||empty($data["weight"])||empty($data["date"])) {
    die(json_encode(array("code" => 400, "msg" => "格式错误")));
}
$edit_one_data = new Mysql();
$result = $edit_one_data->addOrEditData(
    "update weights set name='{$data["name"]}',date='{$data["date"]}',weight={$data["weight"]} where id={$data["id"]};"
);
die(json_encode($result));